]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
popupMenu: Fix submenu signal connector leak
authorSebastian Keller <skeller@gnome.org>
Mon, 14 Sep 2026 02:00:50 +0000 (04:00 +0200)
committerFlorian Müllner <fmuellner@gnome.org>
Mon, 14 Sep 2026 12:31:31 +0000 (14:31 +0200)
Neither `PopupMenuBase` nor the `PopupSubMenu` that is used as `menu` of
`PopupSubMenuMenuItem` is destroyable, so the connection needs to be
manually disconnected when the `PopupSubMenu` is destroyed, otherwise
the signal tracker and with it the `PopupSubMenu` is being leaked.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/4426>
(cherry picked from commit 4a0d2e424a4b37ab6264e871a92044c8b83cc5fe)

js/ui/popupMenu.js

index 7dce5b66138e0389361ef9af18450f9c9dff32df..3ab4a9ee4972b4d5878486e18c32d29bac57e070 100644 (file)
@@ -902,8 +902,10 @@ export class PopupMenuBase extends Signals.EventEmitter {
                 this.box.insert_child_below(menuItem.menu.actor, beforeItem);
 
             this._connectItemSignals(menuItem);
-            menuItem.menu.connectObject('active-changed',
-                this._subMenuActiveChanged.bind(this), this);
+            menuItem.menu.connectObject(
+                'active-changed', this._subMenuActiveChanged.bind(this),
+                'destroy', () => menuItem.menu.disconnectObject(this),
+                this);
             this.connectObject('menu-closed', () => {
                 menuItem.menu.close(BoxPointer.PopupAnimation.NONE);
             }, menuItem);